package com.jt.helloworld.designpattern.visitor;

public class Computer implements ComputerPart {

    ComputerPart[] parts;

    public Computer(){
        parts = new ComputerPart[]{new Monitor(), new Monitor(), new Keyboard()};
    }
    @Override
    public void accept(ComputerPartVisitor computerPartVisitor) {
        for(ComputerPart computerPart: parts){
            computerPart.accept(computerPartVisitor);
        }
        computerPartVisitor.visit(this);
    }
}
